package leetcode.code0260;

import java.util.HashMap;
import java.util.Map;

public class Solution1 extends Solution260 {

	@Override
	public int[] singleNumber(int[] nums) {
		Map<Integer, Integer> map = new HashMap<>();
		for (int num : nums) {
			int count = map.getOrDefault(num, 0);
			if (count == 0) {
				map.put(num, 1);
			} else {
				map.remove(num);
			}
		}
		int[] ans = new int[2];
		int p = 0;
		for (Integer key : map.keySet()) {
			ans[p++] = key;
		}
		return ans;
	}

	public static void main(String[] args) {
		Solution1 so = new Solution1();
		so.debug1();
		so.debug2();
		so.debug3();
	}

}
